package com.yy.micro.magic.data.model.base;

import org.springframework.util.StringUtils;

import java.util.Date;

public final class AuditHelper {

    private AuditHelper() {
    }

    public static void update(AuditSupport support) {
        if (null != support) {
            Date now = new Date();
            if (StringUtils.isEmpty(support.getCreateBy())) {
                support.setCreateBy(1002);
            }
            if (null == support.getCreateTime()) {
                support.setCreateTime(now);
            }
            support.setModifiedTime(now);
            support.setModifiedBy(1002);
        }
    }
}
